﻿using System;
using System.CodeDom;
using System.CodeDom.Compiler;
using System.Data;
using System.Data.SqlClient;
using System.Collections;
using System.IO;
using System.Net;
using System.Xml;
using BP.DA;
using BP.En;
using Microsoft.CSharp;
using BP.Web;
using BP.Difference;
using Newtonsoft.Json.Linq;

namespace BP.Sys
{
    /// <summary>
    /// WebApi参数s
    /// </summary>
    public class SFApiPara : EntityMyPK
    {
        #region 参数.
        public string AttrKey
        {
            get
            {
                return this.GetValStrByKey("AttrKey");
            }
        }
        public string AttrName
        {
            get
            {
                return this.GetValStrByKey("AttrName");
            }
        }
        /// <summary>
        /// 常量表达式
        /// </summary>
        public string ExpDoc
        {
            get
            {
                return this.GetValStrByKey("ExpDoc");
            }
        }
        /// <summary>
        /// 模式：@0=常量@1=业务单元
        /// </summary>
        public int ApiParaModel
        {
            get
            {
                return this.GetValIntByKey("ApiParaModel");
            }
        }
        /// <summary>
        ///存储位置: @0=存储到Cookies(比如:token)@1=(不存储)即时计算
        /// </summary>
        public int ApiParaStore
        {
            get
            {
                return this.GetValIntByKey("ApiParaStore");
            }
        }
        
        public int DataType
        {
            get
            {
                return this.GetValIntByKey("DataType");
            }
        }
        #endregion 参数.

        #region 构造方法
        public override UAC HisUAC
        {
            get
            {
                UAC uac = new UAC();
                uac.Readonly();
                return uac;
            }
        }
        /// <summary>
        /// 用户自定义表
        /// </summary>
        public SFApiPara()
        {
        }
        public SFApiPara(string no)
        {
            this.MyPK = no;
            this.Retrieve();
        }
        /// <summary>
        /// EnMap
        /// </summary>
        public override Map EnMap
        {
            get
            {
                if (this._enMap != null)
                    return this._enMap;
                Map map = new Map("Sys_SFApiPara", "WebApi参数");

                // MyPK= RefPK+"_"+BH;
                map.AddMyPK();
                map.AddTBString("DBSrcNo", null, "数据源", false, false, 1, 200, 20);
                map.AddTBString("AttrKey", null, "列英文名", true, true, 1, 200, 100);
                map.AddTBString("AttrName", null, "列中文名", true, false, 0, 200, 100);
                map.AddDDLSysEnum("ApiParaModel", 0, "模式", true, true, "ApiParaModel", "@0=常量@1=业务单元");
                map.AddDDLSysEnum("ApiParaStore", 0, "存储位置", true, true, "ApiParaStore", "@0=存储到Cookies(比如:token)@1=(不存储)即时计算");
                map.AddDDLSysEnum("DataType", 1, "数据类型", true, true, "ParaDataType", "@1=String@2=Int@3=Float");
                map.AddTBString("ExpDoc", null, "常量表达式", true, false, 0, 200, 100, true, "-对常量类型的参数有效");
                 
                this._enMap = map;
                return this._enMap;
            }
        }
        #endregion
    }
    /// <summary>
    /// WebApi参数s
    /// </summary>
    public class SFApiParas : EntitiesMyPK
    {
        #region 构造
        /// <summary>
        /// WebApi参数s
        /// </summary>
        public SFApiParas()
        {
        }
        /// <summary>
        /// 得到它的 Entity
        /// </summary>
        public override Entity GetNewEntity
        {
            get
            {
                return new SFApiPara();
            }
        }
        #endregion

        #region 为了适应自动翻译成java的需要,把实体转换成List.
        /// <summary>
        /// 转化成 java list,C#不能调用.
        /// </summary>
        /// <returns>List</returns>
        public System.Collections.Generic.IList<SFApiPara> ToJavaList()
        {
            return (System.Collections.Generic.IList<SFApiPara>)this;
        }
        /// <summary>
        /// 转化成list
        /// </summary>
        /// <returns>List</returns>
        public System.Collections.Generic.List<SFApiPara> Tolist()
        {
            System.Collections.Generic.List<SFApiPara> list = new System.Collections.Generic.List<SFApiPara>();
            for (int i = 0; i < this.Count; i++)
            {
                list.Add((SFApiPara)this[i]);
            }
            return list;
        }
        #endregion 为了适应自动翻译成java的需要,把实体转换成List.
    }
}
